var i;
Object.defineProperty(exports, "__esModule", {
  value: true
});
var EventManager = require("AA_EventManager");
var ResKeeper = require("AA_ResKeeper");
var CommonUtils = require("AA_CommonUtils");
var EvenType = require("AA_EvenType");
var GameDataManager = require("AA_GameDataManager");
var _decorator = cc._decorator;
var _ccclass = _decorator.ccclass;
var _property = _decorator.property;

var _def_UI_GameYinBi = function (e) {
  function _creator() {
    var t = null !== e && e.apply(this, arguments) || this;
    t.icon = null;
    t.cost = null;
    t.addBtn = null;
    return t;
  }
  __extends(_creator, e);
  _creator.prototype.onLoad = function () {};
  _creator.prototype.onEnable = function () {
    EventManager.EventMgr.addEventListener(EvenType.EVENT_TYPE.Game_YinBiValue, this.initYinBi, this);
    EventManager.EventMgr.addEventListener(EvenType.EVENT_TYPE.Game_Add_YinBi, this.addYinBi, this);
    this.initYinBi();
    this.addBtn.node.on("click", function () {
      EventManager.EventMgr.dispatchEvent(EvenType.EVENT_TYPE.Game_Show_AddMoneyView, "获取银币");
    }, this);
  };
  _creator.prototype.addYinBi = function (e, t, o, n) {
    undefined === t && (t = null);
    undefined === n && (n = true);
    CommonUtils.default.showCoin(this.icon.node.convertToWorldSpaceAR(cc.v2()), t, e, "yinbi", n, o);
  };
  _creator.prototype.initYinBi = function () {
    this.cost.string = GameDataManager.GameDataMgr.sliderCoin + "";
  };
  _creator.prototype.onDisable = function () {
    EventManager.EventMgr.rmEventListener(EvenType.EVENT_TYPE.Game_YinBiValue, this.initYinBi, this);
    EventManager.EventMgr.rmEventListener(EvenType.EVENT_TYPE.Game_Add_YinBi, this.addYinBi, this);
    this.addBtn.node.targetOff(this);
  };
  _creator.prototype.IsShowBtn = function () {
    this.addBtn.node.active = false;
  };
  __decorate([_property(cc.Sprite)], _creator.prototype, "icon", undefined);
  __decorate([_property(cc.Label)], _creator.prototype, "cost", undefined);
  __decorate([_property(cc.Button)], _creator.prototype, "addBtn", undefined);
  return __decorate([_ccclass], _creator);
}(ResKeeper.default);
exports.default = _def_UI_GameYinBi;